package com.bweab.service.impl;

import com.bweab.dao.api.DormitoryTbDaoInterface;
import com.bweab.dao.impl.DormitoryTbDaoImpl;
import com.bweab.pojo.DormitoryTb;
import com.bweab.service.api.DormitoryTbServiceInterface;
/**
 * 充值记录查询服务接口的实现
 * */
public class DormitoryTbServiceInterfaceImpl implements DormitoryTbServiceInterface {
    //创建DormitoryTbDao
    DormitoryTbDaoInterface dormitoryTbDao=new DormitoryTbDaoImpl();//创建寝室dao

    @Override
    public DormitoryTb getDormitoryInfo(String dormitoryName) {
        //调用dao层
        DormitoryTb dormitoryInfo= dormitoryTbDao.getDormitoryInfo(dormitoryName);
        return dormitoryInfo;
    }


    /**
     * @param dormitoryname   寝室名字
     * @param dormitorymonkey 寝室水电费金钱
     * @param dormitoryid  寝室id
     * @return 返回结果为影响的行数
     */
    @Override
    public int alterDormitoryInfo(String dormitoryname, int dormitorymonkey, int dormitoryid) {

        //调用dao层
        int rows= dormitoryTbDao.alterDormitoryInfo(dormitoryname,dormitorymonkey,dormitoryid);
        return rows;
    }


    /**
     *
     * @param dormitoryName 寝室名字
     * @param dormitoryFee  寝室费用
     * @return 1成功 0 失败
     */
    @Override
    public int addDormitory(String dormitoryName, int dormitoryFee) {

        //调用寝室dao
        int rows= dormitoryTbDao.addDormitoryInfo(dormitoryName,dormitoryFee) ;
        return rows;
    }

    /**
     *
     * @param dormitoryname 寝室名字
     * @return  返回结果为1 成功 0 失败
     */
    @Override
    public int deleteDormitoryInfo(String dormitoryname) {
        int rows=dormitoryTbDao.deleteDormitoryInfo(dormitoryname);
        return rows;
    }
}
